(ns btree.common)

(defn take-1st-half
	[a]
	(take (Math/floor (/ (count a) 2)) a)
)

(defn take-2nd-half
	[a]
	(take-last (Math/floor (/ (count a) 2)) a)
)

(defn take-middle-element
	[a]
	(nth a (Math/floor (/ (count a) 2)))
)

(defn insert-at
	[sequ index element]
	(concat (take index sequ) [element] (drop index sequ))
)

(defn notnil? [a] 
	(not (nil? a))
)

(defn remove-at
  "remove elem in coll"
  [coll pos]
  (vec (concat (subvec coll 0 pos) (subvec coll (inc pos))))
)
